﻿<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    void Page_Load(object sender, MenuEventArgs e)
    {
       
    }
  protected  void clickdata(object sender,  GridViewRowEventArgs e)
    {
      if(e.Row.RowType== DataControlRowType.DataRow)
      {
         DateTime date1=(DateTime)DataBinder.Eval(e.Row.DataItem,"date");
        SqlDataSource srcmo = (SqlDataSource)e.Row.FindControl("srcmo");
        srcmo.SelectParameters["date"].DefaultValue = date1.ToString();
}
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
 <script type="text/javascript">

     function displayCalendar() {
         var datePicker = document.getElementById('datePicker');
         datePicker.style.display = 'block';
     }
    
    </script>
<script type="text/javascript">


    function MM_preloadImages() { //v3.0
        var d = document; if (d.images) {
            if (!d.MM_p) d.MM_p = new Array();
            var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
                if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
        }
    }
    function MM_findObj(n, d) { //v4.01
        var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
            d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
        }
        if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
        for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
        if (!x && d.getElementById) x = d.getElementById(n); return x;
    }
    function MM_swapImage() { //v3.0
        var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
            if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
    }
    function MM_swapImgRestore() { //v3.0
        var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
    }




</script>
 <style type="text/css">
        #datePicker
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
           
        }
    
    </style>
<style type="text/css">
html
{
  background-image:url('image/back.jpg'); 

    padding:10px;
    color:White;    
  
}
.content
{
    width:950px;
    margin:auto;
        height: 197px;
    }
a
{
 color: white;
 text-decoration:none;

}
a:hover
{
 color: red; 
  text-decoration:none;

}
.link
{
  margin-left:350px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.link2
{
  margin-left:50px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.link3
{
  margin-left:300px; 
     font-weight:bold;

}
.join
{
   background-color:#0099FF;
  clip:auto;
  font-weight:bold;
  font-size:large;
}
.table2
{
 border-style:solid;
   border-color:Black;
   background-color:White;
   color:Black;  
   width:900px; 
}
.row
{
   background-color:Gray;
   color:White;
}
.ticket
{
   background-color:#CC0000;
color:White;

}
ticket.a
{
 color: white;
 text-decoration:none;

}
ticket.a:hover
{
 color: black; 
  text-decoration:none;


}
        
.footer
{

   margin-top:250px;
}
.movielist
{
    background-color:White;
    color:Black;
}
.movietitle
{
    color:Black;
}

.f
{
 float:left;
 width:900px;
}
</style>
    <title>Movie detail Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content">
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="1000" height="130">
  <param name="movie" value="image/sample.swf?clickTAG=Default.aspx" />
  <param name="quality" value="high" />
  <param name="allowScriptAccess" value="always" />
  <param name="wmode" value="transparent">
     <embed src="sample.swf?clickTAG=Default.aspx"
      quality="high"
      type="application/x-shockwave-flash"
      WMODE="transparent"
      width="1000"
      height="130"
      pluginspage="http://www.macromedia.com/go/getflashplayer"
      allowScriptAccess="always" />
</object>


<asp:HyperLink ID="HyperLink14"  CssClass="link" NavigateUrl="~/Default.aspx" runat="server">Home</asp:HyperLink>
<asp:HyperLink ID="HyperLink1"  CssClass="link2" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink> <asp:HyperLink ID="HyperLink2" CssClass="link2" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" CssClass="link2"  NavigateUrl="~/Price.aspx" runat="server">Prices</asp:HyperLink>
<asp:HyperLink ID="HyperLink6" CssClass="link2"  NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink>
 <br /> <br />
      

   <br />
<asp:Label ID="Label4" runat="server" ></asp:Label><asp:Label ID="Label5" runat="server" Text="UserName:" CssClass="link3" ></asp:Label>  <asp:LoginName ID="LoginName1" runat="server" /> &nbsp;&nbsp;&nbsp<asp:HyperLink ID="HyperLink15" NavigateUrl="~/myaccount.aspx" Font-Bold="True" Font-Underline="True" runat="server"  ForeColor="Yellow" />&nbsp;&nbsp;&nbsp
    <asp:LoginStatus ID="LoginStatus1" runat="server" /><br/><br/>

 
 <div class="movielist">	       
        <asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" >
            
        <ItemTemplate>
  <table cellpadding="5" cellspacing="2" >
  <tr><td>
 <asp:ImageButton ID="Image1" runat="server" ImageUrl=  '<%# "Movie/" + Eval("imagefname")%>' PostBackUrl="~/Movie.aspx" ImageAlign="Left" />
&nbsp;<asp:HyperLink ID="HyperLink4" runat="server" Font-Bold="True" Font-Size="Larger" CssClass="movietitle" NavigateUrl="~/Movie.aspx" ><%#Eval("MovieTitle") %></asp:HyperLink><br /><br />

&nbsp;&nbsp;<asp:Label ID="Label1" runat="server" Text="Release Date: " Font-Bold="True"></asp:Label><asp:Label ID="Label3" runat="server" Text='<%#Eval("TheatreDateReleased","{0:dd/MM/yyyy}")%>' ForeColor="black"></asp:Label>
  <br />
&nbsp;&nbsp;<asp:Label ID="Label6" runat="server" Text="Rating: " Font-Bold="True"></asp:Label><asp:Label ID="Label2" runat="server" Text='<%#Eval("Rating")%>'  ForeColor="Red"></asp:Label><br />
&nbsp;&nbsp;<asp:Label ID="Label7" runat="server" Text="Movie Director: " Font-Bold="True"></asp:Label><asp:Label ID="Label8" runat="server" Text='<%#Eval("MovieDirector")%>' ></asp:Label><br />
&nbsp;&nbsp;<asp:Label ID="Label9" runat="server" Text="Length: " Font-Bold="True"></asp:Label><asp:Label ID="Label5" runat="server" Text='<%#Eval("MovieDuration")%>' Font-Bold="True" ForeColor="#0099FF"></asp:Label> <br />
&nbsp;&nbsp;<asp:Label ID="Label10" runat="server" Text="Main Cast: " Font-Bold="True"></asp:Label><asp:Label ID="Label11" runat="server" Text='<%#Eval("maincast")%>' ></asp:Label> <br />
&nbsp;&nbsp;<asp:Label ID="Label12" runat="server" Text="Theatre Name: " Font-Bold="True"></asp:Label><asp:Label ID="Label13" runat="server" Text='<%#Eval("TheatreName")%>' ></asp:Label> <br />
 <br />
   <%#Eval("MovieDescription")%><br />  <br />
   
     <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource2" 
            OnRowDataBound="clickdata" AutoGenerateColumns="False"  CssClass="f"
            ShowHeader="False"   Width="500" RowStyle-Wrap="false"  >       
        <Columns>
        
<asp:TemplateField>

<ItemTemplate >

    <asp:Label ID="Label1" runat="server" Text='<%#Eval("date","{0:dd/MM/yyyy}") %>'  BorderWidth="1" BorderColor="Black" />
    <asp:GridView ID="GridView2" DataSourceID="srcmo"   AutoGenerateColumns="false" runat="server" PagerStyle-HorizontalAlign="Right">   
<Columns> 
<asp:BoundField DataField="cinema" HeaderText="Cinema" />
<asp:HyperLinkField DataTextField="time"  DataNavigateUrlFields="sessionid,movieid,cinema,sessiontype,date" DataNavigateUrlFormatString="ticket/ticket.aspx?session={0}&movieid={1}&cinema={2}&sessiontype={3}&date={4:dd/MM/yyyy}"    HeaderText="Session Time"    ControlStyle-ForeColor="#990033" />

    
    </Columns>
   
</asp:GridView>
<asp:SqlDataSource ID="srcmo" runat="server"
 ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
      SelectCommand="SELECT distinct [date],[cinema],[time],[movieid],[cinema],[sessiontype],session2.sessionid FROM [session2],[datesession] WHERE ([date]=@date) AND ([movieid]=@movieid) AND datesession.sessionid=session2.sessionid  ">
      <SelectParameters>
     <asp:Parameter  DbType="Date" Name="date" />
      </SelectParameters>
<SelectParameters>
 <asp:QueryStringParameter Name="movieid" QueryStringField="movie" 
            Type="Int16" />
</SelectParameters>
      </asp:SqlDataSource>
      </ItemTemplate>
</asp:TemplateField>    
            
        </Columns>
        </asp:GridView> 
  <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>"  
            
            SelectCommand="SELECT DISTINCT date, movieid FROM datesession WHERE (movieid = @MovieId)">
<SelectParameters>
 <asp:QueryStringParameter Name="MovieId" QueryStringField="movie" 
            Type="Int16" />
</SelectParameters>
      
</asp:SqlDataSource> 
      

<td><object type="application/x-shockwave-flash" data='<%#Eval("Trailers")%>' width="380" height="270">
<param name="movie" value='<%#Eval("Trailers")%>' /></td></tr><br />
  
</table>
  </ItemTemplate> 
        </asp:DataList>
 </div>
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            
            
            
            SelectCommand="SELECT Movie.MovieId, Movie.CategoryId, Movie.MovieTitle, Movie.TheatreId, Movie.MovieDescription, Movie.MovieDirector, Movie.Rating, Movie.imagefname, Movie.MovieDuration, Movie.TheatreDateReleased, MovieCategory.MovieCategoryName, Movie.Trailers, Movie.maincast, Theatre.TheatreName FROM Movie INNER JOIN MovieCategory ON Movie.CategoryId = MovieCategory.MovieCategoryId INNER JOIN Theatre ON Movie.TheatreId = Theatre.TheatreId WHERE (Movie.MovieId = @MovieId)">
<SelectParameters>
 <asp:QueryStringParameter Name="MovieId" QueryStringField="movie" 
            Type="Int16" />

</SelectParameters>
        </asp:SqlDataSource>
        

 
    </form>
    <table width="100" cellpadding="15" ><tr><td>Copyright@2012 MovieTix</td><td><asp:HyperLink ID="HyperLink8"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Homepage</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink9"  CssClass="footer" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink10"  CssClass="footer" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink12"  CssClass="footer" NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink13"  CssClass="footer" NavigateUrl="~/Login.aspx" runat="server">Log In</asp:HyperLink></td></tr></table>
</body>
</html>
